Skip to content

fix(fleet-paperwork): create readback compares body, state and labels (#6901) - #7799

Merged
dezren39 merged 3 commits into
mainfrom
queue/11300-6901-paperwork-create-readback
Nov 10, 2026
Merged

dezren39 merged 3 commits into
mainfrom
queue/11300-6901-paperwork-create-readback

Conversation

@dezren39

@dezren39 dezren39 commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Summary

fleet-paperwork create's readback verified only the created issue's title and number. The README promises the comparison covers (title, body, state), so a create whose body was dropped or mangled — or whose labels were never applied — reported created+verified and every downstream consumer treated it as complete.

This makes the code match the documented contract, and adds the labels that were sent.

Changes

  • infra/fleet-paperwork/fleet_paperwork.py — cmd_create's readback now also compares:
    • body against exactly what was sent (length + shape in the diagnostic),
    • state against open (a freshly created issue),
    • labels — every requested --label must appear in the readback; extra labels GitHub added are tolerated.
  • infra/fleet-paperwork/README.md — the verification bullet now names the label comparison.
  • infra/fleet-paperwork/tests/test_fleet_paperwork.py — new TestCreateReadback covering the failure modes and the passing cases.

Verification

cd infra/fleet-paperwork && python3 -m unittest discover -s tests
Ran 36 tests — OK

Oracle check: with the previous fleet_paperwork.py restored, the four failure-mode tests fail —

FAIL: test_closed_state_fails
FAIL: test_dropped_body_fails
FAIL: test_mangled_body_fails
FAIL: test_missing_labels_fail

— and all 36 pass with the fix, so the tests detect the regression rather than merely passing.

Acceptance criteria

  • Create readback compares at least body and state (and labels when labels were requested) against what was sent, dying on mismatch like the title check does.
  • A unit test with a readback payload whose body differs proves the failure; a matching payload passes.
  • Existing fleet-paperwork tests still pass.

Closes #6901


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…#6901)

cmd_create's readback verified only title and number, so a create whose
body was dropped or mangled, or whose labels were not applied, reported
'created+verified'. The README already promised the comparison covers
(title, body, state); this makes the code match it and adds the labels
that were sent.

Tests cover the four failure modes (dropped body, mangled body, closed
state, missing labels) plus the passing and extra-label cases; the four
failure-mode tests fail against the previous implementation.
@dezren39
dezren39 requested a review from a team as a code owner November 8, 2026 19:56
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-10T19:19:08.496275Z
We couldn’t complete this review. Comment @codex review to try again.
e48c43c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91142b0b7f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dezren39
dezren39 requested a balanced review from Copilot November 9, 2026 23:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

3 open issues
What changed in this PR

Aligns fleet-paperwork create’s post-create readback verification with the documented contract by validating more than just issue title/number, preventing false “created+verified” results when body/state/labels are incorrect.

Changes:

  • Extend create readback verification to compare issue body, state, and requested labels.
  • Update README to document label verification on create.
  • Add unit tests to cover pass/fail scenarios for body/state/labels readback validation.
File Description
infra/​fleet-paperwork/​fleet_paperwork.py Strengthens create readback verification to include body/state/labels mismatches.
infra/​fleet-paperwork/​README.md Documents label comparison as part of create verification.
infra/​fleet-paperwork/​tests/​test_fleet_paperwork.py Adds tests ensuring readback validation fails on dropped/mangled body, wrong state, or missing labels.

Review effort: Lite

Comment on lines +473 to +478
if got.get("body") != body:
die(
f"readback mismatch for {args.repo}#{number}: body sent "
f"{len(body)} chars, read back {len(got.get('body') or '')} chars "
f"(body={_shape_name(got.get('body'))})"
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e48c43c (task 11300, lane code-m shepherd): shape-safe readback diagnostics — lengths computed only for strings (n/a otherwise), labels matched as a set of string names with malformed entries dying as a readback mismatch, fake_http stub aligned with fp.http() (body/expect). New tests: test_non_string_body_readback_fails_cleanly, test_malformed_label_entry_fails_cleanly. Full suite: 38 tests OK on the laptop.

Comment on lines +486 to +490
have = sorted(
lbl.get("name") if isinstance(lbl, dict) else lbl
for lbl in (got.get("labels") or [])
)
missing = [name for name in want if name not in have]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e48c43c (task 11300, lane code-m shepherd): shape-safe readback diagnostics — lengths computed only for strings (n/a otherwise), labels matched as a set of string names with malformed entries dying as a readback mismatch, fake_http stub aligned with fp.http() (body/expect). New tests: test_non_string_body_readback_fails_cleanly, test_malformed_label_entry_fails_cleanly. Full suite: 38 tests OK on the laptop.

Comment on lines +196 to +200
def fake_http(method, path, token, payload=None):
paths.append((method, path))
if method == "POST":
return 200, created
return 200, readback

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e48c43c (task 11300, lane code-m shepherd): shape-safe readback diagnostics — lengths computed only for strings (n/a otherwise), labels matched as a set of string names with malformed entries dying as a readback mismatch, fake_http stub aligned with fp.http() (body/expect). New tests: test_non_string_body_readback_fails_cleanly, test_malformed_label_entry_fails_cleanly. Full suite: 38 tests OK on the laptop.

… review)

Body/label readback comparisons no longer raise TypeError on non-string bodies or malformed label entries: lengths are computed defensively, labels are matched as a set of string names, and malformed entries die with a readback mismatch. fake_http stub aligned with fp.http() signature (body/expect). Adds tests for non-string body readback and malformed label entries.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fleet-paperwork: create readback verifies only title+number, not the body/state/labels the README promises

2 participants